from math import pi
import flet 

def main(page: flet.Page):

    c = flet.Container(
        width=100,
        height=70,
        bgcolor="blue",
        border_radius=5,
        rotate=flet.transform.Rotate(0, alignment=flet.alignment.center),
        animate_rotation=flet.animation.Animation(300, flet.AnimationCurve.BOUNCE_OUT),
 )

    def animate(e):
        c.rotate.angle += pi / 2
        page.update()

    page.vertical_alignment = flet.MainAxisAlignment.CENTER
    page.horizontal_alignment = flet.CrossAxisAlignment.CENTER
    page.spacing = 30
    page.add(
        c,
        flet.ElevatedButton("Animate!", on_click=animate),
 )
if __name__=="__main__":
    flet.app(target=main)